package com.dy.utils;

import lombok.EqualsAndHashCode;

/**
 * @Author: dy
 * @date: 2024/5/7 10:23
 * @ClassDescription: 自定义异常处理
 */
public class BadCustomException extends RuntimeException{
    private Integer errorCode;

    private String errorMsg;

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public BadCustomException(Integer errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BadCustomException(ErrorEnum errorEnum) {
        super(errorEnum.getErrorMsg());
        this.errorCode = errorEnum.getErrorCode();
        this.errorMsg = errorEnum.getErrorMsg();
    }

    public BadCustomException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

}
